#pragma once

#include <unordered_map>
#include "../share/user_define.h"
#include "../../3rd/libjson/json.h"

/*
"id": 1.0,
"hero_rate": 20.0,
"hero_card": 107000300.0,
"soul_stone1": [106000100,106000200,106000300],
"soul_stone2": [106000200,106000300,106000400],
"soul_stone3": [106000300,106000400,106000500],
"soul_stone4": [106000400,106000500,106000100],
"soul_stone5": [106000500,106000200,106000100],
"soul_stone6": [106000100,106000200,106000400],
"soul_stone7": [106000100,106000200,106000500],
"stone_panta": 20.0,
"stone_decuple": 10.0,
"exp_rate": [2,100],
"exp_material": [[105000100,5,50],[105000200,3,50]],
"gold_material": [[104000100,7,30],[104000200,5,30],[104000300,3,30]],
"prop_double": 20.0,
"prop_triple": 10.0,
"prop_ultra": 2.0,
"diamond_cost": 400.0,
"give_exp": [105000100,1]
*/

struct Condition3x
{
	uint32_t mValue[3];
};

struct SoulDraw
{
	uint32_t mId;
	uint32_t mHeroRate;
	uint32_t mHeroCard;
	uint32_t mSoulStone1[3];
	uint32_t mSoulStone2[3];
	uint32_t mSoulStone3[3];
	uint32_t mSoulStone4[3];
	uint32_t mSoulStone5[3];
	uint32_t mSoulStone6[3];
	uint32_t mSoulStone7[3];
	uint32_t mStonePanta;
	uint32_t mStoneDecuple;
	uint32_t mExpRate[2];
	std::vector<Condition3x> mExpMaterial;
	std::vector<Condition3x> mGoldMaterial;
	uint32_t mPropDouble;
	uint32_t mPropTriple;
	uint32_t mPropUltra;
	uint32_t mDiamondCost;
	uint32_t mGiveExp[2];

	SoulDraw()
	{
		Clear();
	}

	void Clear(void)
	{

	}
};

class SoulDrawCacheData
{
public:

	static void CreateInstance(void);
	static SoulDrawCacheData* GetInstance(void);

	~SoulDrawCacheData(void);

public:

	bool Initialization(void);

	bool Reload(void);

	SoulDraw* GetData(uint32_t id);

	bool GetDataJsonString(uint32_t id, Json::Value& _jm);

	uint32_t GetDataCount(void);

private:
	SoulDrawCacheData(void);

	void Clear(void);

	void AddData(uint32_t id, Json::Value& jm);


private:

	static SoulDrawCacheData* mInstance;

	std::unordered_map<uint32_t, SoulDraw*> m_mapCacheData;
	uint32_t m_maxCount;

};



